﻿using System.Text;

namespace msilgc.cbuilder.CSyntaxTree
{
    internal class NotStatement : ICStatementWithAssignment
    {
        private readonly IVariable _source;
        public IVariable Target { get; set; }
        public bool OnStack { get; set; }

        public NotStatement(IVariable source, IVariable target)
        {
            OnStack = true;
            Target = target;
            _source = source;
        }

        public void Emit(StringBuilder builder)
        {
            Target.Emit(builder);
            builder.Append(" = ~");
            _source.Emit(builder);
            builder.AppendLine(";");
        }
    }
}
